class Job_Object:
    def __init__(self,I):
        self.I=I
        self.Start=[]
        self.End=[]
        self.T=[]
        self.assign_for=[]
    def _add(self,S,E,Machine,t):
        #obs:安排的对象
        self.Start.append(S)
        self.End.append(E)
        self.assign_for.append(Machine)
        self.T.append(t)



class Machine_Object:
    def __init__(self,I):
        self.I=I
        self.Start=[]
        self.End=[]
        self.T=[]
        self.assign_for=[]

        self.Start_Switch = []
        self.End_Switch = []
        self.assign_Switch = []
        self.T_Switch = []

    def _add(self,S,E,obs,t):
        #obs:安排的对象
        self.Start.append(S)
        self.End.append(E)
        self.Start.sort()
        self.End.sort()
        self.assign_for.insert(self.End.index(E),obs)
        self.T.insert(self.End.index(E),t)

    def _add_Switch(self,S,E,obs,t):
        self.Start_Switch.append(S)
        self.End_Switch.append(E)
        self.assign_Switch.append(obs)
        self.T_Switch.append(t)

    def idle_time(self):
        Idle=[]
        if len(self.Start) > 0 and self.Start[0]!=0:
            Idle.append([0,self.Start[0]])
        if len(self.Start) > 1:
            for i in range(len(self.Start)-1):
                if self.Start[i+1] > self.End[i]:
                    Idle.append([self.End[i],self.Start[i+1]])
        return  Idle
